package com.leo.listener;

import org.quartz.JobExecutionContext;
import org.quartz.Trigger;
import org.quartz.TriggerKey;
import org.quartz.TriggerListener;

/**
 * @ClassName MyTriggerListener
 * @Description trigger监听器
 * @Author wangss
 * @date 2021.07.15 10:37
 * @Version 1.0
 */
public class MyTriggerListener implements TriggerListener {
    @Override
    public String getName() {
        return "MyTriggerListener";
    }

    @Override
    public void triggerFired(Trigger trigger, JobExecutionContext jobExecutionContext) {
        TriggerKey key = jobExecutionContext.getTrigger().getKey();
        System.out.println("trigger = [" + key + "] 开始执行");
    }

    @Override
    public boolean vetoJobExecution(Trigger trigger, JobExecutionContext jobExecutionContext) {
        return false;
    }

    @Override
    public void triggerMisfired(Trigger trigger) {

    }

    @Override
    public void triggerComplete(Trigger trigger, JobExecutionContext jobExecutionContext, Trigger.CompletedExecutionInstruction completedExecutionInstruction) {
        TriggerKey key = jobExecutionContext.getTrigger().getKey();
        System.out.println("trigger = [" + key + "] 执行完成");
    }
}
